#ifndef _PAINTGRAPHICS_PAINTGRAPHICS_H_
#define _PAINTGRAPHICS_PAINTGRAPHICS_H_

#include <QWidget>
#include <QColor>
#include <QHash>
#include "PubStruct.h"

namespace Ui
{
	class PaintGraphics;
}

class CPaintGraphics : public QWidget
{
	Q_OBJECT
public:
	explicit CPaintGraphics(QWidget* parent = 0);
	~CPaintGraphics();
	
private slots:
	void on_btnBackgroundColor_clicked();
	void on_btnPenColor_clicked();
	void on_btnFillingColor_clicked();
	void on_btnRect_clicked();
	void on_btnRound_clicked();
	void on_btnClean_clicked();

private:
	void selectColor(QColor& color);
	bool eventFilter(QObject* pObj, QEvent* pEvent);
	void paintGraphics();
	void handleMousePress(QEvent* pEvent);
	void handleMouseRelease(QEvent* pEvent);

private:
	Ui::PaintGraphics* m_ui;
	QColor m_backgroundColor;
	QColor m_penColor;
	QColor m_fillingColor;
	Qt::PenStyle m_penStyle;
	CGraphicsType m_graphicsType;
	bool m_bIsStartPaint;
	QHash<int, CDrawingElement> m_drawEles;
	int m_index;
};

#endif // _PAINTGRAPHICS_PAINTGRAPHICS_H_